package com.pactera.error;

public class BizException extends  Exception implements CommonError {

    private CommonError commonError;

    // 直接接受EmBizError的传参构建异常
    public BizException(CommonError commonError) {
        super();
        this.commonError = commonError;
    }

    //接受自定义
    public BizException(CommonError commonError,String errorMsg) {
        super();
        this.commonError = commonError;
        this.commonError.setErrorMessage(errorMsg);
    }

    @Override
    public int getErrorCode() {
        return this.commonError.getErrorCode();
    }

    @Override
    public String getErrorMessage() {
        return this.commonError.getErrorMessage();
    }

    @Override
    public CommonError setErrorMessage(String errorMessage) {
        this.commonError.setErrorMessage(errorMessage);
        return this;
    }
}
